CREATE TRIGGER Terrorista ON Rab FOR INSERT
AS

DECLARE @ujkod int,@buntenynev nvarchar(50)

SELECT @ujkod=id FROM INSERTED

SELECT @buntenynev=b.nev
FROM Rab r, RabBunteny n,Bunteny b
WHERE r.id=n.rab_id AND n.bunteny_id=b.id AND r.id=@ujkod

IF @buntenynev='terrorizmus'
BEGIN
DELETE FROM rab WHERE id=@ujkod
END